home *** CD-ROM | disk | FTP | other *** search
- MALLOC(3I) Last changed: 4-13-99
-
-
- NNAAMMEE
- MMAALLLLOOCC, FFRREEEE - Allocates and deallocates main memory
-
- SSYYNNOOPPSSIISS
- MMAALLLLOOCC (([NN==]_n_b_y_t_e_s))
-
- CCAALLLL FFRREEEE (([PP==]_i_p_t_r))
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- UNICOS, UNICOS/mk, IRIX systems
-
- CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77
-
- SSTTAANNDDAARRDDSS
- Fortran extension
-
- DDEESSCCRRIIPPTTIIOONN
- MMAALLLLOOCC and FFRREEEE provide a simple general-purpose memory allocation
- package. MMAALLLLOOCC returns a pointer to a block of at least _n_b_y_t_e_s bytes
- suitably aligned for any use. MMAALLLLOOCC returns the first contiguous
- region of free space found in a circular search from the last block
- allocated or freed, coalescing adjacent free blocks as it searches.
- It calls ssbbrrkk(2) to get more memory from the system when there is no
- suitable space already free.
-
- FFRREEEE is a pointer to a block previously allocated by MMAALLLLOOCC. After
- FFRREEEE is performed, this space is made available for further
- allocation, but its contents are left undisturbed.
-
- As intrinsics, these are elemental functions. They accept the
- following arguments:
-
- _n_b_y_t_e_s The amount to be allocated.
-
- _i_p_t_r A pointer to the block of memory to be freed.
-
- RREETTUURRNN VVAALLUUEESS
- Undefined results occur if the space assigned by MMAALLLLOOCC is overrun or
- if some random number is handed to FFRREEEE.
-
- MMAALLLLOOCC returns a NULL pointer if there is no available memory or if
- the area has been detectably corrupted by storing outside the bounds
- of a block. When this happens the block pointed to by _i_p_t_r can be
- destroyed.
-
- NNOOTTEESS
- For most MIPSpro 7 Fortran 90 and CF90 applications, MMAALLLLOOCC and FFRREEEE
- can be replaced by the AALLLLOOOOCCAATTEE and DDEEAALLLLOOCCAATTEE Fortran statements.
- The statements are simpler and portable.
-
- Search time increases when many objects have been allocated; that is,
- if a program allocates but never frees, then each successive
- allocation takes longer.
-
- IRIX systems can be configured with virtual swap space. This allows
- processes to allocate more virtual memory than is actually available,
- allowing the use of sparse addressing, successful forks and subsequent
- eexxeecc(2)s by programs larger than 1/2 the available virtual memory, and
- so forth. Thus programs using MMAALLLLOOCC can get a successful return.
- Later, however the system may generate a SIGKILL signal if virtual
- memory was overcommitted and processes attempt to actually use all of
- the overcommitted memory. If the system has no virtual swap space
- configured, then processes are limited to using no more virtual memory
- than the sum of physical memory and swap space. See the sswwaapp(1M) man
- page for more information.
-
- SSEEEE AALLSSOO
- sswwaapp(1M)
-
- eexxeecc(2), ssbbrrkk(2)
-
- _I_n_t_r_i_n_s_i_c _P_r_o_c_e_d_u_r_e_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l for the printed version of this
- man page.
-